﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Entity.Migrations
{
    /// <inheritdoc />
    public partial class Init : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "AA001",
                columns: table => new
                {
                    P01 = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    AA02 = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    AccountPassWord = table.Column<string>(type: "varchar(12)", maxLength: 12, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastyLoginTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    P02 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P03 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P04 = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AA001", x => x.P01);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "AA002",
                columns: table => new
                {
                    P01 = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    AA01 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    P02 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P03 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P04 = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AA002", x => x.P01);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Signup",
                columns: table => new
                {
                    P01 = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    P021 = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    A02 = table.Column<double>(type: "double", nullable: false),
                    A03 = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    P031 = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    P02 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P03 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P04 = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Signup", x => x.P01);
                    table.ForeignKey(
                        name: "FK_Signup_AA002_P021",
                        column: x => x.P021,
                        principalTable: "AA002",
                        principalColumn: "P01");
                    table.ForeignKey(
                        name: "FK_Signup_AA002_P031",
                        column: x => x.P031,
                        principalTable: "AA002",
                        principalColumn: "P01");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_Signup_P021",
                table: "Signup",
                column: "P021");

            migrationBuilder.CreateIndex(
                name: "IX_Signup_P031",
                table: "Signup",
                column: "P031");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AA001");

            migrationBuilder.DropTable(
                name: "Signup");

            migrationBuilder.DropTable(
                name: "AA002");
        }
    }
}
